/* Copyright 2023 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

syntax = "proto2";

package tensorflow.converter;

// Additional parameters that control the debug behavior of the Converter.
//
// Next ID: 9
message DebugOptions {
  // If not empty, dumps MLIR to the specified directory. The initial state of
  // the MLIR after import will be dumped at the beginning of each pass manager
  // run. Additionally, MLIR will be dumped before and after each pass
  // depending on pass names and functions matched using the
  // `mlir_dump_pass_regex` and `mlir_dump_func_regex` values.
  optional string mlir_dump_dir = 1 [default = ""];

  // Regular expression that matches the names of passes in pascal case (e.g.,
  // FooPass) before/after which MLIR will be dumped. Effective only if
  // mlir_dump_dir is not empty.
  optional string mlir_dump_pass_regex = 2 [default = ".*"];

  // Regular expression that matches the names of functions to be dumped. MLIR
  // modules are dumped only if there's at least one public function in the
  // module whose name matches the pattern. Effective only if mlir_dump_dir is
  // not empty.
  optional string mlir_dump_func_regex = 3 [default = ".*"];

  // If true, report the execution time of each MLIR pass.
  optional bool mlir_enable_timing = 4 [default = false];

  // Prints MLIR before specified passes. Supports regular expressions for
  // matching against the names of the desired passes.
  optional string mlir_print_ir_before = 5 [default = ""];

  // Prints MLIR after specified passes. Supports regular expressions for
  // matching against the names of the desired passes. Currently only prints
  // after a pass if the MLIR is mutated.
  optional string mlir_print_ir_after = 6 [default = ""];

  // If true, always print the top-level operation when printing IR for
  // print_ir_[before|after].
  optional bool mlir_print_ir_module_scope = 7 [default = true];

  // Elide ElementsAttrs with \"...\" that have more elements than the given
  // upper limit.
  optional int64 mlir_elide_elementsattrs_if_larger = 8;
}
